{% extends 'myadmin/public/base.html' %}

{% block title %}
<title>后台订单列表</title>
{% endblock %}

{% block header %}
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
            <div class="page-header-heading">
                <span class="am-icon-home page-header-heading-icon"></span> 
                订单列表 
            </div>
        </div>
    </div>
{% endblock %}


{% block con %}
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title  am-cf">订单列表</div>
                </div>
                <div class="widget-body  am-fr">

                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-btn-group am-btn-group-xs">
                        </div>
                    </div>

                <form>
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                        <div class="am-form-group tpl-table-list-select">
                            <select name="type" data-am-selected="{btnSize: 'sm'}" style="display: none;">
                              <option value="all" {% if request.GET.type == 'all' %} selected {% endif %} >所有条件</option>
                              <option value="sname" {% if request.GET.type == 'sname' %} selected {% endif %} >收件人</option>
                              <option value="totalprice" {% if request.GET.type == 'totalprice' %} selected {% endif %} >总金额</option>
                              <option value="totalnum" {% if request.GET.type == 'totalnum' %} selected {% endif %} >总数量</option>
                            </select>
                        </div>
                    </div>
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                        <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                            <input type="text" name="keywords" class="am-form-field " value="{{ request.GET.keywords }}">
                            <span class="am-input-group-btn">
                            <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"></button>
                          </span>
                        </div>
                    </div>
                </form>

                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>会员</th>
                                    <th>收件人</th>
                                    <th>地址</th>
                                    <th>电话</th>
                                    <th>总金额</th>
                                    <th>总数量</th>
                                    <th>状态</th>
                                    <th>购买时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            {% for v in userlist %}
                                <tr>
                                    <td class="am-text-middle">{{ v.id }}</td>
                                    <td class="am-text-middle">{{ v.uid.username }}</td>
                                    <td class="am-text-middle">{{ v.addressid.name }}</td>
                                    <td class="am-text-middle">{{ v.addressid.address }}{{ v.addressid.xiangxi }}</td>
                                    <td class="am-text-middle">{{ v.addressid.phone }}</td>
                                    <td class="am-text-middle">{{ v.totalprice }}</td>
                                    <td class="am-text-middle">{{ v.totalnum }}</td>
                                    <!-- <td class="am-text-middle">{{ v.status }}</td> -->
                                    <td class="am-text-middle">
                                        {% if v.status == 0 %}
                                            未付款
                                        {% elif v.status == 1 %}
                                            代发货
                                        {% elif v.status == 2 %}
                                            待收货
                                        {% elif v.status == 3 %}
                                            待评价
                                        {% elif v.status == 4 %}
                                            交易完成
                                        {% endif %}

                                    </td>
                                    <td class="am-text-middle">{{ v.addtime|date:"Y-m-d H:i:s" }}</td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <a href="{% url 'myadmin_back_info' %}?uid={{ v.id }}">
                                                <i class="am-icon-pencil"></i> 详情
                                            </a>
                                        </div>
                                        <div class="tpl-table-black-operation">
                                            <a href="{% url 'myadmin_back_edit' %}?uid={{ v.id }}">
                                                <i class="am-icon-pencil"></i> 编辑
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                            {% endfor %}
                        
                                <!-- more data -->
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">

                        <div class="am-fr">
                            <ul class="am-pagination tpl-pagination">
                                <!-- <li class="am-disabled"><a href="#">«</a></li>
                                <li class="am-active"><a href="#">1</a></li>
                                <li><a href="#">2</a></li>
                                <li><a href="#">3</a></li>
                                <li><a href="#">4</a></li>
                                <li><a href="#">5</a></li>
                                <li><a href="#">»</a></li> -->
                                {% load pagetag %}

                                {% PageShow userlist.paginator.num_pages request %} 
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock%}